package action.credit;

/*import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.ServletActionContext;
import com.google.gson.Gson;
*/
import java.util.List;
import model.app.AppLoantype;
import model.app.AppRate;
import model.credit.Lcbank;
import model.grant.Customgrant;
import model.security.UsrUser;
import service.app.CreatKeyService;
import service.credit.AppLoantypeService;
import service.credit.EnterpriseSearchService;
import service.credit.LcBankService;
import service.user.FindAllUserService;
import util.Time;
import vo.EnterpriseInforBean;
import core.action.BaseAction;
import exception.Exceptions;

public class SerachEnterpriseListAjax extends BaseAction {

	private String creditName;
	private String certificatenumber;
	private List<?> EnterpriseInforList;
	private EnterpriseInforBean enterpriseInforBean;
	private String type;
	private Integer clientID;
	private List<UsrUser> userList;
	private AppRate appRate;
	
	/*贷款类型列表*/
	private List<AppLoantype> loantypeList;
	
	private Customgrant customgrant;

	private EnterpriseSearchService enterpriseSearchService;
	private FindAllUserService findAllUserService;
	private AppLoantypeService appLoantypeService;
	private CreatKeyService creatKeyService;
	
	private int autoApplyId;
	
	private List<Lcbank> lcBankList;
	private LcBankService lcBankService;
	
	private String applydate;
	
	private int isLook;
	
	public String loadInfor() throws Exception {
		type = "2";
		this.EnterpriseInforList = this.enterpriseSearchService.get_enterpriseList();
		return "load";
	}
	
	public String loadInforOne() throws Exceptions {
		type = "2";
		this.applydate = Time.Timestamp2DateString(Time.CurrentTimestamp());
		this.autoApplyId = this.creatKeyService.creatKeyFull(41);
		this.loantypeList = this.appLoantypeService.getLoanTypeList();
		this.lcBankList = this.lcBankService.getList(clientID);
		this.enterpriseInforBean = this.enterpriseSearchService.searchOneEnterprise(clientID);
		return "loadOneEnterprise";
	}

	/*public String execute() throws Exceptions{
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setCharacterEncoding("UTF-8");
		PrintWriter out = null;
		try {
			out = response.getWriter();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		if(this.clientID != null){
			List<EnterpriseInforBean> enterpriseInforBeans = new ArrayList<EnterpriseInforBean>();
			EnterpriseInforBean enterpriseInforBean = this.enterpriseSearchService.searchOneEnterprise(clientID);
			try {
				if(enterpriseInforBean == null){
					out.print("null");
				}else{
				enterpriseInforBeans.add(enterpriseInforBean);
				String infor = new Gson().toJson(enterpriseInforBeans);
				p(infor);
				out.print(infor);
				}
			} catch (Exception e1) {
				
			}
		}else{
			List<EnterpriseInforBean> enterpriseInforBeans = this.enterpriseSearchService.searchEnterpriseByName(creditName);
			try {
				if(enterpriseInforBeans == null){
					out.print("null");
				}else{
				String infor = new Gson().toJson(enterpriseInforBeans);
				out.print(infor);
				}
			} catch (Exception e1) {
				
			}
		}
		
		try {
			out.flush();
			out.close();
		} catch (Exception e) {
			
		}
		return "success";
	}*/

	public String getCreditName() {
		return creditName;
	}

	public void setCreditName(String creditName) {
		this.creditName = creditName;
	}

	public EnterpriseInforBean getEnterpriseInforBean() {
		return enterpriseInforBean;
	}

	public void setEnterpriseInforBean(EnterpriseInforBean enterpriseInforBean) {
		this.enterpriseInforBean = enterpriseInforBean;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getClientID() {
		return clientID;
	}

	public void setClientID(Integer clientID) {
		this.clientID = clientID;
	}

	public List<UsrUser> getUserList() {
		return userList;
	}

	public void setUserList(List<UsrUser> userList) {
		this.userList = userList;
	}

	public EnterpriseSearchService getEnterpriseSearchService() {
		return enterpriseSearchService;
	}

	public void setEnterpriseSearchService(
			EnterpriseSearchService enterpriseSearchService) {
		this.enterpriseSearchService = enterpriseSearchService;
	}

	public FindAllUserService getFindAllUserService() {
		return findAllUserService;
	}

	public void setFindAllUserService(FindAllUserService findAllUserService) {
		this.findAllUserService = findAllUserService;
	}

	public Customgrant getCustomgrant() {
		return customgrant;
	}

	public void setCustomgrant(Customgrant customgrant) {
		this.customgrant = customgrant;
	}

	public AppRate getAppRate() {
		return appRate;
	}

	public void setAppRate(AppRate appRate) {
		this.appRate = appRate;
	}

	public String getCertificatenumber() {
		return certificatenumber;
	}

	public void setCertificatenumber(String certificatenumber) {
		this.certificatenumber = certificatenumber;
	}

	public AppLoantypeService getAppLoantypeService() {
		return appLoantypeService;
	}

	public void setAppLoantypeService(AppLoantypeService appLoantypeService) {
		this.appLoantypeService = appLoantypeService;
	}

	public List<?> getEnterpriseInforList() {
		return EnterpriseInforList;
	}

	public void setEnterpriseInforList(List<?> enterpriseInforList) {
		EnterpriseInforList = enterpriseInforList;
	}

	public List<AppLoantype> getLoantypeList() {
		return loantypeList;
	}

	public void setLoantypeList(List<AppLoantype> loantypeList) {
		this.loantypeList = loantypeList;
	}

	public CreatKeyService getCreatKeyService() {
		return creatKeyService;
	}

	public void setCreatKeyService(CreatKeyService creatKeyService) {
		this.creatKeyService = creatKeyService;
	}

	public int getAutoApplyId() {
		return autoApplyId;
	}

	public void setAutoApplyId(int autoApplyId) {
		this.autoApplyId = autoApplyId;
	}

	public List<Lcbank> getLcBankList() {
		return lcBankList;
	}

	public void setLcBankList(List<Lcbank> lcBankList) {
		this.lcBankList = lcBankList;
	}

	public LcBankService getLcBankService() {
		return lcBankService;
	}

	public void setLcBankService(LcBankService lcBankService) {
		this.lcBankService = lcBankService;
	}

	public String getApplydate() {
		return applydate;
	}

	public void setApplydate(String applydate) {
		this.applydate = applydate;
	}

	public int getIsLook() {
		return isLook;
	}

	public void setIsLook(int isLook) {
		this.isLook = isLook;
	}

}
